knitr::opts_chunk$set(echo = TRUE)
library(mROC)
library(pROC)
n<-100000

Correct model

p<-rbeta(n,2,3)
y<-rbinom(n,1,p)

plot(roc(y,p))
lines(mROC(p),col="red")

Now lets transform the risks

p<-rbeta(n,2,3)
y<-rbinom(n,1,p)

odds<-p/(1-p)
odds<-odds*3
p<-odds/(1+odds)

plot(roc(y,p))
lines(mROC(p),col="red")

But mROC is not transformation-invariant. Consider this one, based on 'shrunk' beta distirbution for risks (I agree it is a bit extreme):

p<-rbeta(n,0.5,0.5)/10
y<-rbinom(n,1,p)

odds<-p/(1-p)
odds<-odds*10
p<-odds/(1+odds)

plot(roc(y,p))
lines(mROC(p),col="red")


Shoodood/mROC documentation built on Feb. 5, 2021, 3:21 p.m.